/*
 * @Description:
 * @FilePath: /glm_h5wxgzh/api/login.js
 */
import request from '@/utils/request'

// 登录方法
export function login(data) {
  return request({
    url: '/login',
    headers: {
      isToken: false
    },
    method: 'post',
    data
  })
}

// 注册方法
export function register(data) {
  return request({
    url: '/register',
    headers: {
      isToken: false
    },
    method: 'post',
    data: data
  })
}

// 获取用户详细信息
export function getInfo(data) {
  return request({
    url: '/getInfo',
    method: 'get',
    data: data
  })
}

// 根据openID判断是否首次登录
export function receiveXcxOpenId(data) {
  return request({
    url: '/receiveXcxOpenId',
    method: 'post',
    data: data
  })
}

// 三库查询
export function receivePhone(data) {
  return request({
    url: '/receivePhone',
    method: 'post',
    data: data
  })
}

// 获取手机号
export function getWXPhoneNumber(data) {
  return request({
    url: '/glm/wx/getPhoneNumber',
    method: 'get',
    data: data
  })
}

// 获取用户信息
export function getWXOpenId(data) {
  return request({
    url: '/glm/wx/getOpenId',
    method: 'get',
    data: data
  })
}

// 获取短信验证码
export function getSortMessageCode(data) {
  return request({
    url: '/loginCaptcha',
    method: 'get',
    data: data
  })
}
// 短信验证码校验
export function sortMessageCodeViliate(data) {
  return request({
    url: '/checkCaptcha',
    method: 'get',
    data: data
  })
}
// 解绑方法
export function removeBinding() {
  return request({
    url: '/removeBindingXcxOpenId',
    method: 'post'
  })
}
// 退出方法
export function logout() {
  return request({
    url: '/logout',
    method: 'post'
  })
}
// 首次登录, 强制修改密码
export function forceResetPwdAPI(params, data, token) {
  return request({
    headers: {
      isToken: true,
      Authorization: 'Bearer ' + token
    },
    url: '/system/user/resetPwd',
    method: 'put',
    params,
    data
  })
}

// 获取验证码
export function getCaptcha(data) {
  return request({
    url: '/captcha',
    method: 'get',
    data
  })
}
// 验证码校验
export function checkCaptcha(data) {
  return request({
    url: '/checkCaptcha',
    method: 'get',
    data
  })
}
